# -*- coding: utf-8 -*-

"""
DateTime   : 2020/12/23 17:33
Author     : ZhangYafei
Description: 
"""
# file_object = open('info.txt', mode='r+', encoding='utf-8')
#
# # 读取内容
# data = file_object.read()
# print(data)
#
# # 写入内容
# file_object.write("你好呀")
#
# file_object.close()


# file_object = open('info.txt', mode='r+', encoding='utf-8')
#
# # 写入内容
# file_object.write("李白")
#
# # 读取内容
# data = file_object.read()
# print(data)  # 明月光
#
# file_object.close()

# file_object = open('info.txt', mode='wt+', encoding='utf-8')
#
# # 读取内容
# data = file_object.read()
# print(data)
#
# # 写入内容
# file_object.write("你好呀")
#
# # 将光标位置重置起始
# file_object.seek(0)
#
# # 读取内容
# data = file_object.read()
# print(data)  # 你好呀
#
# file_object.close()


# file_object = open('info.txt', mode='at+', encoding='utf-8')
# # 写入内容
# file_object.write("张亚飞")
#
# # 将光标位置重置起始
# file_object.seek(0)
#
# # 读取内容
# data = file_object.read()
# print(data)
#
# file_object.close()

# f = open('info.txt', mode='r',encoding='utf-8')
#
# # 读1个字符
# chunk1 = f.read(1)
# chunk2 = f.read(2)
# print(chunk1,chunk2)
#
# f.close()

# f = open('info.txt', mode='rb')
#
# # 读1个字节
# data = f.read(3)
# f.close()
#
# print(data, type(data))  # b'\xe5\xba\x8a' <class 'bytes'>

# f = open('info.txt', mode='rb')
#
# # 读1个字节
# chunk1 = f.read(3)
# chunk2 = f.read(3)
# chunk3 = f.read(1)
# print(chunk1,chunk2,chunk3) # b'\xe5\xba\x8a' b'\xe5\x89\x8d' b'\xe6'
#
# f.close()

# f = open('info.txt', mode='r', encoding='utf-8')
#
# v1 = f.readline()
# print(v1)
#
# v2 = f.readline()
# print(v2)
#
# f.close()

# f = open('info.txt', mode='r', encoding='utf-8')
# v1 = f.readline()
# print(v1)
# f.close()
#
# f = open('info.txt', mode='r', encoding='utf-8')
# v2 = f.readline()
# print(v2)
# f.close()

# f = open('info.txt', mode='r', encoding='utf-8')
#
# data_list = f.readlines()
#
# f.close()
#
# print(data_list) # ['床前明月光\n', '疑是地上霜']
f = open('info.txt', mode='r', encoding='utf-8')
for line in f:
    print(line.strip())
f.close()
# 床前明月光
# 疑是地上霜